<template>
  <div class="item-title" :class="[size]" :style="computedStyle">
    <span class="title">{{ title }}</span>
    <div class="other" v-if="otherInfo.length">
      <div v-for="item in otherInfo" :key="item.label">
        <span class="label">{{ item.label }}：</span>
        <span class="value num-font">{{ item.value }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ItemTitle",
  props: {
    width: {
      type: String,
      default: "100%",
    },
    title: {
      type: String,
      default: "项目信息",
      required: true,
    },
    otherInfo: {
      type: Array,
      default: () => [],
    },
    size: {
      default: "",
      type: String
    },
    bottom: {
      type: String,
      default: "16px"
    }
  },
  computed: {
    computedStyle() {
      const style = {};
      style.width = this.width;
      style.marginBottom = this.bottom;
      return style;
    }
  }
};
</script>

<style lang="scss">
.item-title {
  // background: url("../assets/imgs/title-bg.png") no-repeat center left;
  //background-size: 100% 100%;
  background-size: cover;
  height: 32px;
  padding-left: 16px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  &.large {
    // background-image: url("../assets/imgs/v2/title_large.svg");
  }
  .title {
    font-size: 18px;
    font-weight: 600;
    color: #e2f5fd;
    line-height: 32px;
  }
  .other {
    display: flex;
    font-size: 16px;
    line-height: 32px;
    padding-top: 3px;
    & > div {
      margin-left: 16px;
    }
    .value {
      color: #f7b115;
      font-size: 18px;
      //line-height: 32px;
    }
  }
}
</style>
